package io.renren.modules.admin.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.admin.entity.CouresResouseEntity;
import io.renren.modules.admin.service.CouresResouseService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 课程表-学生资源（视频）
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-12-17 18:24:00
 */
@RestController
@RequestMapping("admin/couresresouse")
public class CouresResouseController {
    @Autowired
    private CouresResouseService couresResouseService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("admin:couresresouse:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = couresResouseService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{couresResouseId}")
    @RequiresPermissions("admin:couresresouse:info")
    public R info(@PathVariable("couresResouseId") Long couresResouseId){
		CouresResouseEntity couresResouse = couresResouseService.getById(couresResouseId);

        return R.ok().put("couresResouse", couresResouse);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("admin:couresresouse:save")
    public R save(@RequestBody CouresResouseEntity couresResouse){
		couresResouseService.save(couresResouse);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("admin:couresresouse:update")
    public R update(@RequestBody CouresResouseEntity couresResouse){
		couresResouseService.updateById(couresResouse);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("admin:couresresouse:delete")
    public R delete(@RequestBody Long[] couresResouseIds){
		couresResouseService.removeByIds(Arrays.asList(couresResouseIds));

        return R.ok();
    }

}
